<template>
   <div id="list">  
        <ul>
            <li v-for="item in list" :key="item.id" class="item">
                <div class="product-info">
                    <div class="product-img shutu">
                       <img class="deal-img imglazy" :src="item.image_url">
                    </div>
                    <div class="product-name">{{item.short_name}}</div>
                    <div class="tag_text"><span>{{item.tag_text}}</span></div>
                    <div class="price-info"><span class="exceed-hidden activity-jumei-price"><span class="price">￥{{item.jumei_price}}</span><span class="old">￥{{item.market_price}}</span></span></div>
                    <div class="buyer-and-comments">{{item.comments_number}}</div>
                </div>
            </li>
        </ul>
    </div>
</template>
<script>
export default {
        name: "list-item",
        props:{
            contuan_data:{
                type:String,
                required: true,
                default: null
            }
        },
       
        data() {
            return {
                list: [], // 列表数组
            }
        },    
        methods: {
             getList() { // 根据参数获取数据列表   
              if(this.contuan_data=='contuan_home'){        
               this.axios.get(`/api1/pop/ajaxGetAllProduct?merchant_id=&search_type=14&brand_id=&store_id=8044&page=1&sort=&category_id=&price_range=&function_id=&series_id=&is_sellable=&timestamp=1583548657081&locateDM=0&show_comment=1&is_filter_coutuan=0
                `).then(res=>{
                        console.log(res.data.data.data.rows)
                        this.list = res.data.data.data.rows
                    })    
              } else {
                  this.axios.get(`/api1/pop/ajaxgetnewproduct?brand_id=&merchant_id=&search_type=14&category_id=&store_id=8044&page=1&locateDM=0&show_comment=1&is_filter_coutuan=0
                `).then(res=>{
                        console.log(res.data.data.rows["03-08"].list)
                        this.list = res.data.data.rows["03-08"].list
                    })        
              }
            },
        },
        mounted() {
            this.getList() // 组件第一次挂载就运行一次
        }
    }
</script>
<style scoped>
ul{
    font-size: 0;
    padding-left: .25rem;
    overflow: hidden;
}
.item{
    margin-right: .25rem;
    padding-bottom: 4px;
    width: 48.5%;
    vertical-align: top;
    float: left;
    margin-bottom: .25rem;
    position: relative;
    border-radius: .1875rem;
    background: #fff;
}
.product-img{
    height: 239px;
    margin-bottom: 9px;
    text-align: center;
    overflow: hidden;
    position: relative;
}
.deal-img {
    height: 239px;
    width: 100%;
    border-top-left-radius: .1875rem;
    border-top-right-radius: .1875rem;
}
.product-name {
    font-size: 14px;
    line-height: 18px;
    height: 36px;
    padding: 0 .5625rem;
    color: #333;
    font-size: .8125rem;
    line-height: 1.125rem;
    height: 2.25rem;
    word-break: break-all;
    word-wrap: break-word;
    overflow: hidden;
    text-align: left;
}
.tag_text {
    padding: 4px 9px 4px 9px;
    height: 12px;
    line-height: 12px;
    overflow: hidden;
    color: #999;
    text-align: left;
}
.tag_text span {
    padding-right: 4px;
    font-size: 11px;
    margin-bottom: 5px;
    display: inline-block;
}
.price-info {
    padding: 0 9px;
    font-size: 12px;
    position: relative;
    font-family: Arial;
    text-align: left;
    overflow: hidden;
}
.activity-jumei-price {
    display: flex;
    height: 20px;
    align-items: center;
    word-break: break-all;
    text-overflow: ellipsis;
    overflow: hidden;
}
.price {
    font-size: 18px;
    color: #fe4070;
    line-height: 1.25rem;
    float: left;
}
.old {
    margin-left: .3125rem;
    color: #999;
    font-size: .75rem;
    line-height: 1.25rem;
    height: 1.25rem;
    text-decoration: line-through;
    float: left;
}
.buyer-and-comments{
    padding: 4px 8px 0 8px;
    text-align: left;
    font-size: 11px;
    height: 12px;
    line-height: 12px;
    color: #999;
    overflow: hidden;
}
</style>
